<template>

	<view class="content">
			<view>
				<navigator url="/pages/index/task/usertask"><button type="default" size="mini">查看我的任务</button></navigator>
		
			</view>
		<view class="page-section" indexListBox>
			<view class="indexList" v-for="(item,index) in tableData" :key="index">
	
					<view>任务名称:{{item.taskName}} &nbsp;</view>
					<view>计划周期:{{item.taskPeriod}} &nbsp;</view>
					<view>计划简介:{{item.taskDesc}} &nbsp;</view>
					<view>积分:{{item.taskIntegral}} &nbsp;</view>
	       
		   <view>
		   	<!-- <button class="mini-btn" type="warn" size="mini" form-type="submit"  @click="bbslive(item.fileId)">点赞</button> -->
	
		   	<template  v-bind:id="item.taskId">
		   	       <button @click="attention(item)"  size="mini" type="warn" >领取任务</button>
		   	    </template>
		   </view>
		   
		   
		   
		</view>
	</view>
</view>	
</template>

<script>
	export default {
		data() {
			return {
				taskId:'',
				tableData: [],
				commentContent :'',
				comments:[]
			}
		},onLoad(){
			this.tasklist();

		},
		methods:{
			tasklist(){
				uni.request({
				    url: 'http://localhost:7000/task/task/findall', //仅为示例，并非真实接口地址。
				    method: 'POST',
				    success: (res) => {
						console.log(res.data.data)
				        this.tableData=res.data.data
						//console.log(this.Data)
				    }
				});
			},
			attention(item){
				console.log("------------------------------",item)
				this.taskId=item.taskId
				uni.request({
				url: 'http://localhost:7000/task/task/insertTbUserTask',//仅为示例，并非真实接口地址。
				data: {
						userId:3,
						taskId:this.taskId
					},
				       method: 'POST',
				       success: (res) => {
				   		console.log(res.data.data)
				           this.tableData=res.data.data
				   		console.log(this.Data)
						this.tasklist()
				       }
				   });
				   console.log(this.fileId)
				}
		}
	}
</script>

 <style>
	 .indexList uni-image {
	            width: 100%;
	            height: 130px;
	            background: #eaeaea;
	        }
	        .indexList {
	            margin-top: 15px;
	            margin-bottom: 15px;
	        }
	        .indexList .title {
	            background: #000;
	            color: #fff;
	            font-size: 16px;
	            line-height: 37px;
	            padding: 0 10px;
	            margin-top: -5px;
	    }
	       .indexListBox{
	           margin-top: 20px;
	       }
		   .image {
		   		width: 50rpx;
		   		height: 80rpx;
		   	}

</style>

 
